﻿using System;
using System.Web.UI.WebControls;
using BLL;

public partial class ProductAirtightness_AirtightnessView_AirtightnessStisticbyDT : System.Web.UI.Page
{
    private Airtightness a;

    public ProductAirtightness_AirtightnessView_AirtightnessStisticbyDT()
    {
        a = new Airtightness();
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindDTBetween();
        }
    }

    protected void BindDTBetween()
    {
        this.DropDownList1.DataSource = DayandNightShift.list;
        this.DropDownList1.DataTextField = "steptext";
        this.DropDownList1.DataValueField = "stepvalue";
        this.DropDownList1.DataBind();
    }

    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        this.GridView1.PageIndex = e.NewPageIndex;
        BindAirtightnessQ();
    }

    protected void Button1_Click(object sender, EventArgs e)
    {        
        BindAirtightnessQ();
    }

    protected void BindAirtightnessQ()
    {
        string day = this.TextBox1.Text.Trim();
        string[] dtbetween = this.DropDownList1.SelectedValue.Split(',');
        DateTime var_starttime = DateTime.Parse(day + dtbetween[0]);
        DateTime var_stoptime = DateTime.Parse(day + dtbetween[1]);
        if (var_starttime > var_stoptime)
        {
            var_stoptime = var_stoptime.AddDays(1);
        }
        GridView1.DataSource = a.Airtightness_GetQbyPIDDT(var_starttime, var_stoptime);
        GridView1.DataBind();
    }
}
